package com.example.demo.repository;

import com.example.demo.entity.Product;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2018/1/18 0018.
 */
public interface ProductRepository extends JpaRepository<Product,Long> {

    @Query("select p from Product p join p.user u  where  u.id=?1 ")
    List<Product> findByUserId(@Param("userId") Long userId);

}
